#include "button.h"
#include <iostream>
using namespace std;

CButton::CButton() {

}

CButton::CButton(int tx, int ty, int tw, int th, string tp, int tv, CScene *scena) {
    x = tx;
    y = ty;
    w = tw;
    h = th;
    property = tp;
    value = tv;
    gamescene = scena;
}

void CButton::Push() {
    if (gamescene->GetRegistryValue(property) == value)
        gamescene->SetRegistryValue(property,0);
    else
        gamescene->SetRegistryValue(property,value);
}

bool CButton::Detect(int tx, int ty) {
    return (tx >= x && tx <= x + w && ty >= y && ty <= y+h);
}
